import { _decorator, Component, easing, Game, Label, Node, tween, v3 } from 'cc';
import { ModuleBase } from '../Card/ModuleBase';
import { GameData } from '../GameData';
const { ccclass, property } = _decorator;

@ccclass('Score')
export class Score extends ModuleBase {
    private score:number=0;
    get _score(){
        return this.score;
    }
    set _score(score){
        this.score=score;
    }
    private Label:Label=null;
    private cardpairL:Label=null;
    onInit(...rest: any[]): void {
        this.Label=this.node.getChildByName("_ScoreLabel").getComponent(Label);
        this.Label.string=this.score.toString();
        this.cardpairL=this.node.getChildByName("CardPairLabel").getComponent(Label);
    }
    //修改分数
    modifyScore(addscore:number){
        this.score+=addscore;
        this.Label.string=this.score.toString();
    }
    //牌型提醒
    remindCardPair(cardPair:string){
        this.cardpairL.node.active=true;
        this.cardpairL.string=cardPair;
        tween(this.cardpairL.node)
        .to(0.5,{scale:v3(1.5,1.5)},{easing:'elasticOut'})
        .call(()=>{
            this.cardpairL.node.scale=v3(1,1);
            this.cardpairL.node.active=false;
        })
        .start()
    }
}


